function init_grid () {
    $("#orderlist").flexigrid({
        url: _webroot+'/sales/order_list',
        dataType: 'json',
        colModel: [
            { display: 'Order ID', name: 'id', width: 60, sortable: true, align: 'right' },
            { display: 'Payment Type', name: 'payment_type', width: 95, sortable: true, align: 'left' },
            { display: 'Order Time', name: 'sales_date', width: 120, sortable: true, align: 'center' },
            { display: 'Payment Status', name: 'payment_status', width: 80, sortable: true, align: 'left' },
            { display: 'Order Status', name: 'order_status', width: 80, sortable: true, align: 'left' },
            { display: 'Delivery Method', name: 'delivery_method', width: 80, sortable: true, align: 'left' },
            { display: 'Amount', name: 'amount', width: 60, sortable: true, align: 'right' },
            { display: 'Amount (RM)', name: 'amount_converted', width: 60, sortable: true, align: 'right' },
            { display: 'BV', name: 'total_pv', width: 50, sortable: true, align: 'right' },
            //{ display: 'Stockist ID', name: 'stockist_id', width: 50, sortable: true, align: 'left' },
            { display: 'View', name: 'actions', width: 30, align: 'center' }
        ],
        searchitems: [
            { display: 'Order ID', name: 'id', isdefault: true },
            { display: 'Amount', name: 'amount' },
            { display: 'BV', name: 'total_pv' }
        ],
        sortname: 'id',
        sortorder: 'asc',
        usepager: true,
        title: 'Order',
        useRp: true,
        rp: 15,
        showTableToggleBtn: false,
        width: 855,
        height: 300
    });
} // init_grid

function reload_grid () {
    $("#orderlist").flexReload();
} // reload_grid

function message (msg, focus) {
    alert(msg);

    if (typeof focus != 'undefined') {
        Ext.fly(focus).focus();
    }
} // message

function init () {
    init_grid();
} // init